/**
 * Notification level for the notification service
 * INFO = 1: Page sidebar notification, popup disappears automatically
 * IMPORTANT = 2: Page sidebar notification, popup doesn't disappear automatically
 * WARNING = 3: Page popup notification, synchronized with WeChat notification
 * CRITICAL = 4: Page popup notification, WeChat and phone notification
 */
export enum NotificationLevel {
  INFO = 1,
  IMPORTANT = 2,
  WARNING = 3,
  CRITICAL = 4
}

export enum NotificationTopic {
  TRADE = "trade",
  MARKET = "market",
  OPS = "ops"
}

/**
 * Notification schema for the notification service
 */
export interface NotificationSchema {
  /** Notification ID */
  id?: string;

  /** Notification topic */
  topic: NotificationTopic;

  /** Notification level */
  level: NotificationLevel;

  /** Extra information for frontend display */
  extra?: string;

  /** Notification title */
  title: string;

  /** Notification content */
  content: string;

  /** ISO format timestamp */
  msg_datetime: string;

  /** Read status (frontend only) */
  isRead?: boolean;
}

/**
 * Response model for notification history
 */
export interface NotificationHistory {
  history: NotificationSchema[];
  event_id: string;
}

export const getTopicNameCN = (topic: NotificationTopic) => {
  switch (topic) {
    case NotificationTopic.TRADE:
      return "交易";
    case NotificationTopic.MARKET:
      return "行情";
    case NotificationTopic.OPS:
      return "运维";
    default:
      return topic;
  }
};
